%%
    addpath includes
    % Whick detectors / ranges to plot
    plotokna=[6 7];
    % Colors
    cl=       'rbggkrkbr';
    % Legend labels
    oknolabel={'T','S1-G1','S1-G2','S1-G3','S1-Z','S2-G1','S2-G2','S2-G3','S2-Z'};
    % Ticks on y axis
    tempy=(9.655:0.005:9.680)*10^-3;
%% Period evolution
    clf
    for okno=plotokna
    extrems=ones(size(res,1),1);
    valex  =extrems;
    
    ers=valex*0;
    
    for i=1:size(res,1)
        %%
        try
           a=gather(sum(res(i,:,1:5,okno),3));
           extrems(i)=find(a==max(a),1);
           valex(i)=(a(extrems(i)));
           er=[];
           for k=1:5
                 t=gather(res(i,extrems(i),k,okno));
                 if t>12
                     er(k)=pi./sqrt(3)./(anint*24*3600)/k/sqrt(t);
                 else
                     er(k)=+inf;
                 end
           end
           ers(i)=(sum(er.^-2))^(-0.5);
        end
    end
    %
    sp=1.0*(baddays>1-1/10^2);
    tempval=valex./lN(:,okno)*2.*sp';
    %
    sp(ers>1e-3)=0;
    sp=1.0*(sp>0);
    sp(sp<1)=NaN;
    
    h=errorbar(datelist',...
        sp.*freqlist(extrems),...
        ers,...
        [cl(okno) 's'], ...
        'MarkerSize',4);
    errorbar_tick(h,500);
    hold on
    grid on

                             
    set(gca,...
        'YTick',tempy,...
        'YTickLabel',sprintf('%3.3f|',tempy*1000))
    ylabel('Spin Frequency [Hz]'); 
    legend(oknolabel(okna),'Location','NorthWest')    

    datetick('x','mm.dd')
    
    end
    
%% Profile
   